	
// EnumAdresseType.h : Declaration of the CEnumAdresseType

#ifndef __ENUMADRESSETYPE_H_
#define __ENUMADRESSETYPE_H_

#include "resource.h"       // main symbols
#include "importado.h"
#include "database.h"

/////////////////////////////////////////////////////////////////////////////
// CEnumAdresseType
class ATL_NO_VTABLE CEnumAdresseType : 
	public CComObjectRootEx<CComMultiThreadModel>,
	public CComCoClass<CEnumAdresseType, &CLSID_EnumAdresseType>,
	public ISupportErrorInfo,
	public IDispatchImpl<IEnumAdresseType, &IID_IEnumAdresseType, &LIBID_EBASDLLLib>
{
public:
	CEnumAdresseType();
	virtual ~CEnumAdresseType();

DECLARE_REGISTRY_RESOURCEID(IDR_ENUMADRESSETYPE)
DECLARE_GET_CONTROLLING_UNKNOWN()

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CEnumAdresseType)
	COM_INTERFACE_ENTRY(IEnumAdresseType)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(ISupportErrorInfo)
	COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
END_COM_MAP()

	HRESULT FinalConstruct()
	{
		return CoCreateFreeThreadedMarshaler(
			GetControllingUnknown(), &m_pUnkMarshaler.p);
	}

	void FinalRelease()
	{
		m_pUnkMarshaler.Release();
	}

	CComPtr<IUnknown> m_pUnkMarshaler;

// ISupportsErrorInfo
	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);

// IEnumAdresseType
public:
	STDMETHOD(Clone)(/*[out]*/ IEnumeration ** ppEnumeration);
	STDMETHOD(Reset)();
	STDMETHOD(Skip)(/*[in]*/ ULONG cItems);
	STDMETHOD(Next)(/*[out]*/ IUnknown ** ppUnk, /*[out]*/ ULONG * pcFetched);
private:
	_RecordsetPtr m_records;
	bool m_first;
	ULONG m_pos;
	ULONG m_length;
};

#endif //__ENUMADRESSETYPE_H_
